<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生列表</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <div class="container">
        <h1 class="text-center">学生列表</h1>
        <a href="{{ url_for('add_student') }}" class="btn btn-primary my-3">添加</a>
        <table class="table table-striped table-hover">
            <thead>
                <tr>
                    <th>学号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>学院编号</th>
                    <th>班级编号</th>
                    <th>住址</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for student in students %}
                <tr>
                    <td>{{ student.Sno }}</td>
                    <td>{{ student.Sname }}</td>
                    <td>{{ student.Ssex }}</td>
                    <td>{{ student.Sage }}</td>
                    <td>{{ student.Dno }}</td>
                    <td>{{ student.Sclass }}</td>
                    <td>{{ student.address }}</td>
                    <td>
                        <a href="{{ url_for('edit_student', sno=student.Sno) }}" class="btn btn-secondary">编辑</a>
                        <form action="{{ url_for('delete_student', sno=student.Sno) }}" method="post" class="d-inline">
                            <button type="submit" class="btn btn-danger">删除</button>
                        </form>
                    </td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>